<?php
/**
 * Created by PhpStorm.
 * User: yyq
 * Date: 2018/2/6
 * Time: 16:53
 * Info: app配置相关
 */

namespace Common\Model;


class AppConfigModel extends CommonModel
{
    /**
     * @return mixed
     */
    public function getConfigInfo() {
        return $this->select();
    }

    /**
     * @param $option_name
     * @return mixed
     */
    public function getOptionValue($option_name) {
        return $this->where(['option_name' => $option_name])->getField('option_value');
    }

    /**
     * @return array
     */
    public function getKeyValue() {
        $result = $this->select();
        $data = [];
        foreach ($result as $k => $v) {
            $data[$v['option_name']] = $v['option_value'];
        }
        return $data;
    }
}